package com.zzh.demo.agentDemo;

import com.zzh.demo.agentDemo.transformer.ClassMethodRunTimeTransformer;

import java.lang.instrument.Instrumentation;

/**
 * description： <br>
 * createTime: 2024/2/29 10:37 <br>
 *
 * @author zzh
 */
public class Agent {

    // 在main方法之前执行
    public static void premain(String args, Instrumentation instrumentation) throws ClassNotFoundException {
        ClassMethodRunTimeTransformer transformer = new ClassMethodRunTimeTransformer();
        instrumentation.addTransformer(transformer);
    }

    // 在attach到虚拟机上时执行，此时一般是main方法已经执行了
//    public static void agentmain (String agentArgs, Instrumentation inst) {
//    }
}
